<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib prefix="sx" uri="/struts-dojo-tags" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <title>BMS</title>
    <script type="text/javascript" src="<s:url value="/js/jquery.validate.min.js"/>"></script>
    <script type="text/javascript" src="<s:url value="/js/cda.js"/>"></script>
</head>
<body>

<s:form id="formEdit" cssClass="tableEdit" >
    <tr>
        <th colspan="4" class="tableTitle">
            <h5>Confidential Disclosure Agreement</h5>
        </th>
    </tr>

    <s:select id="category" list="#{'':'Choose a Category', 'Molecula':'Molecula', 'Master':'Master'}" label="Category" name="category" onchange="getOpcionesCDA($('#category').val())" />

    <s:hidden name="cdaMolecula.id" id="id" value="%{cdaMolecula.id}" ></s:hidden>
    <tr class="molecula">
        <td>
            <label>Drug:</label>
        </td>
        <td>
            <s:select label="Drug" name="cdaMolecula.droga.id" id="droga" value="%{cdaMolecula.droga.id}"
                      headerKey="" headerValue="Choose a Drug"
                      list="drogaList"
                      listKey="id"
                      listValue="drugName"
                      theme="simple">
            </s:select>
        </td>
    </tr>
    <s:hidden id="hdhinvestigatorid" name="hdhinvestigatorid" value="%{cdaMolecula.involucrado.id}"></s:hidden>
    <s:url var="searchInvestigatorURL" action="getInvestigatorsSIByNameSurname1"  namespace="/Directories/Team"/>
    <tr class="molecula">
        <td>
            <label  >Investigator Name:</label>
        </td>
        <td>
            <s:textfield label="Investigator Name" theme="simple" name="investigator" id="investigator" value="%{cdaMolecula.involucrado.apellido}, %{cdaMolecula.involucrado.nombre}" />
            <s:a href="#" onclick="searchInvestigator($('#investigator').val(), '%{searchInvestigatorURL}', 'investigator')" theme="simple" ><img  src="<s:url value="/images/search.png"/>" alt="search"></s:a>

        </td>
    </tr>
    <tr class="molecula">
        <td>
            <label>Date sent:</label>
        </td>
        <td>
            <s:textfield label="Date sent" id="fechaEnviado" cssClass="datepicker"  theme="simple"  />
            <s:hidden name="cdaMolecula.fechaEnviado" id="altfechaEnviado" value="%{cdaMolecula.fechaEnviado}"/>
        </td>
    </tr>
    <tr class="molecula">
        <td>
            <label>Date received:</label>
        </td>
        <td>
            <s:textfield label="Date received" id="fechaRecibido" cssClass="datepicker"  theme="simple" />
            <s:hidden name="cdaMolecula.fechaRecibido" id="altfechaRecibido" value="%{cdaMolecula.fechaRecibido}"/>
        </td>
    </tr>
    <tr  class="molecula">
        <td>
            <label>Signature date:</label>
        </td>
        <td>
            <s:textfield label="Signature Date"  id="signature"  cssClass="datepicker" theme="simple"  onchange="calculateExpirationDate('Molecula', this)"  />
            <s:hidden name="cdaMolecula.signature" id="altsignature" value="%{cdaMolecula.signature}" />
        </td>
    </tr>
    <tr class="molecula">
        <td>
            <label>Expiration Date:</label>
        </td>
        <td>
            <s:textfield label="Expiration Date" id="cdaMoleculaexpiration" cssClass="datepicker" theme="simple" />
            <s:hidden name="cdaMolecula.expiration" id="altcdaMoleculaexpiration" value="%{cdaMolecula.expiration}"/>
        </td>
    </tr>



    <s:hidden name="cdamaster.id" id="id" value="%{cdamaster.id}" ></s:hidden>
    <tr class="master">
        <td>
            <label>Site:</label>
        </td>
        <td>
            <s:select label="Site" name="cdamaster.centro.id" id="site"
                      headerKey="" headerValue="Choose a Site"
                      list="centroList"
                      listKey="id"
                      listValue="institucion"
                      theme="simple">
            </s:select>
        </td>
    </tr>
      <tr  class="master">
            <td>
                <label>Date sent:</label>
            </td>
            <td>
                <s:textfield label="Date sent" id="masterfechaEnviado" cssClass=" datepicker" theme="simple" />
                <s:hidden name="cdamaster.fechaEnviado" id="altmasterfechaEnviado" value="%{cdamaster.fechaEnviado}"/>
            </td>
      </tr>
      <tr  class="master">
            <td>
                <label>Date received:</label>
            </td>
            <td>
                <s:textfield label="Date received" id="masterfechaFirmado" cssClass="datepicker" theme="simple"/>
                <s:hidden name="cdamaster.fechaFirmado" id="altmasterfechaFirmado" value="%{cdamaster.fechaFirmado}"/>
            </td>
      </tr>
    <tr  class="master">
        <td>
            <label>Signature date:</label>
        </td>
        <td>
            <s:textfield label="Signature Date" id="mastersignature" cssClass="datepicker" theme="simple"    onchange="calculateExpirationDate('Master', this)"   />
            <s:hidden name="cdamaster.signature" id="altmastersignature" value="%{cdamaster.signature}"/>
        </td>
    </tr>
    <tr  class="master">
        <td>
            <label>Expiration date:</label>
        </td>
        <td>
            <s:textfield label="Expiration Date" id="cdamasterexpiration" cssClass="datepicker" theme="simple"   />
            <s:hidden name="cdamaster.expiration" id="altcdamasterexpiration" value="%{cdamaster.expiration}"/>
        </td>
    </tr>

    <tr>
        <td colspan="4" class="centeredButtons"><s:submit value="Save" id="save" action="save" onclick="setEmptyDates();validate();"  theme="simple" />
            <s:form action="main" method="POST" theme="simple" >
                <s:hidden id="clear" name="clear" value="1"></s:hidden>
                <s:submit value="Clear" theme="simple" ></s:submit>
            </s:form></td>

    </tr>

</s:form>

<script type="text/javascript">
    hideField();
    $('#cda').css({"color":"#EE5102","fontWeight":"bold"});
    if($('#investigator').val() == ' , ' || $('#investigator').val() == ', ' || $('#investigator').val() == ' ,')
        $('#investigator').val('');
</script>

</body>
</html>
